package com.wk.wechattool.ui;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.TextView;

@SuppressLint("AppCompatCustomView")
public class MyClickTextView extends TextView {
    public MyClickTextView(Context context) {
        super(context);
        initView();
    }

    public MyClickTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    public MyClickTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }


    private void initView(){
    }



    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch (event.getAction()){
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_MOVE:
                this.setTextColor(Color.RED);
                break;
            case MotionEvent.ACTION_UP:
                this.setTextColor(Color.WHITE);
                performClick();
                break;
        }
        return  super.onTouchEvent(event);
    }



    @Override
    public boolean performClick() {
        return super.performClick();
    }
}
